package com.ruoyi.jkcrData.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.jkcrData.domain.plat.DataJkcrYxsd;
import com.ruoyi.jkcrData.domain.plat.JkcrSdParaChange;
import com.ruoyi.jkcrData.service.IDataJkcrYxsdService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 架空乘人运行速度测试数据Controller
 * 
 * @author ruoyi
 * @date 2024-02-19
 */
@RestController
@RequestMapping("/jkcrData/yxsd")
@Api(value="架空乘人-运行速度测试",tags = "架空乘人-运行速度接口")
public class DataJkcrYxsdController extends BaseController
{
    @Autowired
    private IDataJkcrYxsdService dataJkcrYxsdService;

    /**
     * 查询架空乘人运行速度测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:yxsd:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataJkcrYxsd dataJkcrYxsd)
    {
        startPage();
        List<DataJkcrYxsd> list = dataJkcrYxsdService.selectDataJkcrYxsdList(dataJkcrYxsd);
        return getDataTable(list);
    }

    /**
     * 导出架空乘人运行速度测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:yxsd:export')")
    @Log(title = "架空乘人运行速度测试数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataJkcrYxsd dataJkcrYxsd)
    {
        List<DataJkcrYxsd> list = dataJkcrYxsdService.selectDataJkcrYxsdList(dataJkcrYxsd);
        ExcelUtil<DataJkcrYxsd> util = new ExcelUtil<DataJkcrYxsd>(DataJkcrYxsd.class);
        util.exportExcel(response, list, "架空乘人运行速度测试数据数据");
    }

    /**
     * 修改架空乘人-运行速度
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:modifySd:edit')")
    @Log(title = "修改架空乘人-运行速度", businessType = BusinessType.UPDATE)
    @PutMapping("/modifyYxsd")
    @ApiOperation(value="修改架空乘人-运行速度")
    public AjaxResult modifyYxsd(@ApiParam(name="运行速度数据",value="传入json格式",required=true)@RequestBody JkcrSdParaChange jkcrSdParaChange)
    {
        return AjaxResult.success(dataJkcrYxsdService.modifyDataJkcrYxsd(jkcrSdParaChange));
    }

    /**
     * 获取架空乘人运行速度测试数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:yxsd:query')")
    @GetMapping(value = "/{yxsdId}")
    public AjaxResult getInfo(@PathVariable("yxsdId") Long yxsdId)
    {
        return success(dataJkcrYxsdService.selectDataJkcrYxsdByYxsdId(yxsdId));
    }

    /**
     * 新增架空乘人运行速度测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:yxsd:add')")
    @Log(title = "架空乘人运行速度测试数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataJkcrYxsd dataJkcrYxsd)
    {
        return toAjax(dataJkcrYxsdService.insertDataJkcrYxsd(dataJkcrYxsd));
    }

    /**
     * 修改架空乘人运行速度测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:yxsd:edit')")
    @Log(title = "修改架空乘人运行速度测试数据", businessType = BusinessType.UPDATE)
    @PutMapping("/delYxsd/{yxsdId}")
    @ApiOperation(value="修改架空乘人运行速度测试数据")
    public AjaxResult delYxsd(@PathVariable Long yxsdId)
    {
        return toAjax(dataJkcrYxsdService.updateDataJkcrYxsdByYxsdId(yxsdId));
    }

    /**
     * 修改架空乘人运行速度测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:yxsd:edit')")
    @Log(title = "架空乘人运行速度测试数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataJkcrYxsd dataJkcrYxsd)
    {
        return toAjax(dataJkcrYxsdService.updateDataJkcrYxsd(dataJkcrYxsd));
    }

    /**
     * 删除架空乘人运行速度测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:yxsd:remove')")
    @Log(title = "架空乘人运行速度测试数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{yxsdIds}")
    public AjaxResult remove(@PathVariable Long[] yxsdIds)
    {
        return toAjax(dataJkcrYxsdService.deleteDataJkcrYxsdByYxsdIds(yxsdIds));
    }
}
